<template>
<div class="carousel">
  <div class="block">
    <el-carousel height="400px">
      <el-carousel-item v-for="(item,index) in getCarousel" :key="index">
        <div class="box" :style="{background: 'url('+ item.imgUrlPc +')' }"> </div>
      </el-carousel-item>
    </el-carousel>
  </div>
</div>
</template>

<script>


import {getCarousel} from "@/api/index-api";

export default {
  name: "carousel",
  data(){
    return{
      getCarousel:[]
    }
  },
  created() {
    getCarousel().then(res=>{
     this.getCarousel = res.data

    })

  }

}
</script>

<style scoped lang="less">
.block{
 .box {
    color: #475669;
    font-size: 18px;
    opacity: 0.75;
    margin: 0;
   background-repeat: no-repeat !important;
   background-position: 50%  !important;
   width: 100%;
   height: 400px;
   background-size: cover  !important;


  }

  .el-carousel__item:nth-child(2n) {
    background-color: #99a9bf;
  }

  .el-carousel__item:nth-child(2n+1) {
    background-color: #d3dce6;
  }
}

</style>